/*
 * Copyright 2008 Daniel Freitas
 *
 * This file is part of Army Creator.
 * 
 * Army Creator is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * Army Creator is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with Army Creator.  If not, see <http://www.gnu.org/licenses/>.
 */
package cheesr.application.examples;

import org.apache.wicket.markup.html.WebPage;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.model.CompoundPropertyModel;
import org.apache.wicket.model.PropertyModel;
import org.apache.wicket.model.ResourceModel;

public class Labels extends WebPage {

    private class Person {
        String name;

        public Person(String name) {
            this.name = name;
        }

        public String getName() {
            return name;
        }

        public void setName(String name) {
            this.name = name;
        }
    }

    public Labels() {
        setModel(new CompoundPropertyModel(new Person("from CompoundPropertyModel :)")));
        add(new Label("label1", "Hello, World!"));
        add(new Label("label2", new PropertyModel(new Person("My name is Johna"), "name")));
        add(new Label("label3", "Wicket in Action"));
        add(new Label("name"));
        add(new Label("label4", new ResourceModel("key", "default value")));

        // Markup labels
        add(new Label("markupLabel", "<b>This text should be bold</b>"));
        add(new Label("expectedLabel", "<b>This text should be bold</b>").setEscapeModelStrings(false));
        add(new Label("popupLabel", "<h1 onclick='alert(\"clicked!\");'>Click me</h1>").setEscapeModelStrings(false));
    }
}